From: Joey Hess Date: Thu, 25 Sep 2025 17:40:06 +0000 (-0400) Subject: Remove the Servant build flag X-Git-Tag: archive/raspbian/10.20251029-1+rpi1~1^2~3^2~55 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22Program/%22http:/www.example.com/cgi/%22https:/%22Program?a=commitdiff_plain;h=555377e6253035ed6444b7999385e91f4f5603b0;p=git-annex.git Remove the Servant build flag Always build with support for annex+http urls and git-annex p2phttp. --- diff --git a/BuildFlags.hs b/BuildFlags.hs index 0b306a09f4..53ea8e6fe3 100644 --- a/BuildFlags.hs +++ b/BuildFlags.hs @@ -52,11 +52,6 @@ buildFlags = filter (not . null) #ifdef WITH_MAGICMIME , "MagicMime" #endif -#ifdef WITH_SERVANT - , "Servant" -#else -#warning Building without servant, will not support annex+http urls or git-annex p2phttp. -#endif #ifdef WITH_BENCHMARK , "Benchmark" #endif diff --git a/CHANGELOG b/CHANGELOG index 1960ff7d55..1acce80c4f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +git-annex (10.20250926) UNRELEASED; urgency=medium + + * Remove the Servant build flag; always build with support for + annex+http urls and git-annex p2phttp. + + -- Joey Hess Thu, 25 Sep 2025 13:36:21 -0400 + git-annex (10.20250925) upstream; urgency=medium * Fix bug that made changes to a special remote sometimes be missed when diff --git a/CmdLine/GitAnnex.hs b/CmdLine/GitAnnex.hs index 5032278873..97b6c6196d 100644 --- a/CmdLine/GitAnnex.hs +++ b/CmdLine/GitAnnex.hs @@ -118,9 +118,7 @@ import qualified Command.Upgrade import qualified Command.Forget import qualified Command.OldKeys import qualified Command.P2P -#ifdef WITH_SERVANT import qualified Command.P2PHttp -#endif import qualified Command.Proxy import qualified Command.DiffDriver import qualified Command.Smudge @@ -253,9 +251,7 @@ cmds testoptparser testrunner mkbenchmarkgenerator = map addGitAnnexCommonOption , Command.Forget.cmd , Command.OldKeys.cmd , Command.P2P.cmd -#ifdef WITH_SERVANT , Command.P2PHttp.cmd -#endif , Command.Proxy.cmd , Command.DiffDriver.cmd , Command.Smudge.cmd diff --git a/P2P/Http/Client.hs b/P2P/Http/Client.hs index e71e69f28c..17084f0fec 100644 --- a/P2P/Http/Client.hs +++ b/P2P/Http/Client.hs @@ -27,7 +27,6 @@ import Types.NumCopies import Types.Remote import Annex.Common import qualified Git -#ifdef WITH_SERVANT import qualified Annex import Annex.UUID import Annex.Url @@ -51,12 +50,10 @@ import qualified Data.Map as M import Control.Concurrent.Async import Control.Concurrent import System.IO.Unsafe -#endif import Data.Time.Clock.POSIX import qualified Data.ByteString.Lazy as L type ClientAction a -#ifdef WITH_SERVANT = ClientEnv -> ProtocolVersion -> B64UUID ServerSide @@ -64,9 +61,6 @@ type ClientAction a -> [B64UUID Bypass] -> Maybe Auth -> Annex (Either ClientError a) -#else - = () -#endif p2pHttpClient :: Remote @@ -95,7 +89,6 @@ p2pHttpClientVersions' -> (String -> Annex a) -> ClientAction a -> Annex (Maybe a) -#ifdef WITH_SERVANT p2pHttpClientVersions' allowedversion rmt rmtrepo fallback clientaction = case p2pHttpBaseUrl <$> remoteAnnexP2PHttpUrl (gitconfig rmt) of Nothing -> error "internal" @@ -174,10 +167,6 @@ p2pHttpClientVersions' allowedversion rmt rmtrepo fallback clientaction = putTMVar ccv $ Git.CredentialCache $ M.insert (Git.CredentialBaseURL credentialbaseurl) cred cc Nothing -> noop -#else -p2pHttpClientVersions' _ _ _ fallback () = Just <$> fallback - "This remote uses an annex+http url, but this version of git-annex is not built with support for that." -#endif clientGet :: Key @@ -188,7 +177,6 @@ clientGet -> Maybe FileSize -- ^ Size of existing file, when resuming. -> ClientAction Validity -#ifdef WITH_SERVANT clientGet k af consumer startsz clientenv (ProtocolVersion ver) su cu bypass auth = liftIO $ do let offset = fmap (Offset . fromIntegral) startsz withClientM (cli (B64Key k) cu bypass baf offset auth) clientenv $ \case @@ -220,12 +208,8 @@ clientGet k af consumer startsz clientenv (ProtocolVersion ver) su cu bypass aut gather' (S.Yield v s) = LI.Chunk v <$> unsafeInterleaveIO (gather' s) baf = associatedFileToB64FilePath af -#else -clientGet _ _ _ _ = () -#endif clientCheckPresent :: Key -> ClientAction Bool -#ifdef WITH_SERVANT clientCheckPresent key clientenv (ProtocolVersion ver) su cu bypass auth = liftIO $ withClientM (cli su (B64Key key) cu bypass auth) clientenv $ \case Left err -> return (Left err) @@ -241,9 +225,6 @@ clientCheckPresent key clientenv (ProtocolVersion ver) su cu bypass auth = _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> v4 :<|> v3 :<|> v2 :<|> v1 :<|> v0 :<|> _ = client p2pHttpAPI -#else -clientCheckPresent _ = () -#endif -- Similar to P2P.Protocol.remove. clientRemoveWithProof @@ -275,7 +256,6 @@ clientRemoveWithProof proof k unabletoremove remote = useversion v = v >= ProtocolVersion 3 clientRemove :: Key -> ClientAction RemoveResultPlus -#ifdef WITH_SERVANT clientRemove k clientenv (ProtocolVersion ver) su cu bypass auth = liftIO $ withClientM cli clientenv return where @@ -292,15 +272,11 @@ clientRemove k clientenv (ProtocolVersion ver) su cu bypass auth = _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> v4 :<|> v3 :<|> v2 :<|> v1 :<|> v0 :<|> _ = client p2pHttpAPI -#else -clientRemove _ = () -#endif clientRemoveBefore :: Key -> Timestamp -> ClientAction RemoveResultPlus -#ifdef WITH_SERVANT clientRemoveBefore k ts clientenv (ProtocolVersion ver) su cu bypass auth = liftIO $ withClientM (cli su (B64Key k) cu bypass ts auth) clientenv return where @@ -313,12 +289,8 @@ clientRemoveBefore k ts clientenv (ProtocolVersion ver) su cu bypass auth = _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|>_ :<|> _ :<|> _ :<|> _ :<|> v4 :<|> v3 :<|> _ = client p2pHttpAPI -#else -clientRemoveBefore _ _ = () -#endif clientGetTimestamp :: ClientAction GetTimestampResult -#ifdef WITH_SERVANT clientGetTimestamp clientenv (ProtocolVersion ver) su cu bypass auth = liftIO $ withClientM (cli su cu bypass auth) clientenv return where @@ -332,9 +304,6 @@ clientGetTimestamp clientenv (ProtocolVersion ver) su cu bypass auth = _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> v4 :<|> v3 :<|> _ = client p2pHttpAPI -#else -clientGetTimestamp = () -#endif clientPut :: MeterUpdate @@ -349,7 +318,6 @@ clientPut -- ^ Set data-present parameter and do not actually send data -- (v4+ only) -> ClientAction PutResultPlus -#ifdef WITH_SERVANT clientPut meterupdate k moffset af contentfile contentfilesize validitycheck datapresent clientenv (ProtocolVersion ver) su cu bypass auth | datapresent = liftIO $ withClientM (cli mempty) clientenv return | otherwise = do @@ -435,14 +403,10 @@ clientPut meterupdate k moffset af contentfile contentfilesize validitycheck dat _ :<|> _ :<|> _ :<|> _ :<|> v4 :<|> v3 :<|> v2 :<|> v1 :<|> v0 :<|> _ = client p2pHttpAPI -#else -clientPut _ _ _ _ _ _ _ _ = () -#endif clientPutOffset :: Key -> ClientAction PutOffsetResultPlus -#ifdef WITH_SERVANT clientPutOffset k clientenv (ProtocolVersion ver) su cu bypass auth | ver == 0 = return (Right (PutOffsetResultPlus (Offset 0))) | otherwise = liftIO $ withClientM cli clientenv return @@ -463,14 +427,10 @@ clientPutOffset k clientenv (ProtocolVersion ver) su cu bypass auth _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> v4 :<|> v3 :<|> v2 :<|> v1 :<|> _ = client p2pHttpAPI -#else -clientPutOffset _ = () -#endif clientLockContent :: Key -> ClientAction LockResult -#ifdef WITH_SERVANT clientLockContent k clientenv (ProtocolVersion ver) su cu bypass auth = liftIO $ withClientM (cli (B64Key k) cu bypass auth) clientenv return where @@ -490,9 +450,6 @@ clientLockContent k clientenv (ProtocolVersion ver) su cu bypass auth = _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> v4 :<|> v3 :<|> v2 :<|> v1 :<|> v0 :<|> _ = client p2pHttpAPI -#else -clientLockContent _ = () -#endif clientKeepLocked :: LockID @@ -503,7 +460,6 @@ clientKeepLocked -- server. The lock will remain held until the callback returns, -- and then will be dropped. -> ClientAction a -#ifdef WITH_SERVANT clientKeepLocked lckid remoteuuid unablelock callback clientenv (ProtocolVersion ver) su cu bypass auth = do readyv <- liftIO newEmptyTMVarIO keeplocked <- liftIO newEmptyTMVarIO @@ -563,6 +519,3 @@ clientKeepLocked lckid remoteuuid unablelock callback clientenv (ProtocolVersion _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> _ :<|> v4 :<|> v3 :<|> v2 :<|> v1 :<|> v0 :<|> _ = client p2pHttpAPI -#else -clientKeepLocked _ _ _ _ = () -#endif diff --git a/P2P/Http/Types.hs b/P2P/Http/Types.hs index 5da418416f..05a3f77fe7 100644 --- a/P2P/Http/Types.hs +++ b/P2P/Http/Types.hs @@ -19,11 +19,9 @@ import Annex.Common import qualified P2P.Protocol as P2P import Utility.MonotonicClock -#ifdef WITH_SERVANT import Servant import Data.Aeson hiding (Key) import Text.Read (readMaybe) -#endif import qualified Data.Text as T import qualified Data.Text.Encoding as TE import qualified Data.ByteString as B @@ -149,8 +147,6 @@ newtype UnlockRequest = UnlockRequest Bool data Auth = Auth B.ByteString B.ByteString deriving (Show, Generic, NFData, Eq, Ord) -#ifdef WITH_SERVANT - instance ToHttpApiData Auth where toHeader (Auth u p) = "Basic " <> B64.encode (u <> ":" <> p) #if MIN_VERSION_text(2,0,0) @@ -402,5 +398,3 @@ instance PlusClass PutOffsetResultPlus PutOffsetResult where dePlus (PutOffsetResultAlreadyHavePlus _) = PutOffsetResultAlreadyHave plus (PutOffsetResult o) = PutOffsetResultPlus o plus PutOffsetResultAlreadyHave = PutOffsetResultAlreadyHavePlus [] - -#endif diff --git a/P2P/Http/Url.hs b/P2P/Http/Url.hs index b7ec6d22fe..b2a1e4c293 100644 --- a/P2P/Http/Url.hs +++ b/P2P/Http/Url.hs @@ -11,14 +11,12 @@ module P2P.Http.Url where import Data.List import Network.URI -#ifdef WITH_SERVANT import System.FilePath.Posix as P import Servant.Client (BaseUrl(..), Scheme(..)) import Text.Read import Data.Char import qualified Git import qualified Git.Url -#endif defaultP2PHttpProtocolPort :: Int defaultP2PHttpProtocolPort = 9417 -- Git protocol is 9418 @@ -30,9 +28,7 @@ isP2PHttpProtocolUrl s = data P2PHttpUrl = P2PHttpUrl { p2pHttpUrlString :: String -#ifdef WITH_SERVANT , p2pHttpBaseUrl :: BaseUrl -#endif } deriving (Show) @@ -40,21 +36,15 @@ parseP2PHttpUrl :: String -> Maybe P2PHttpUrl parseP2PHttpUrl us | isP2PHttpProtocolUrl us = case parseURI (drop prefixlen us) of Nothing -> Nothing -#ifdef WITH_SERVANT Just u -> case uriScheme u of "http:" -> mkbaseurl Http u "https:" -> mkbaseurl Https u _ -> Nothing -#else - Just _u -> - Just $ P2PHttpUrl us -#endif | otherwise = Nothing where prefixlen = length "annex+" -#ifdef WITH_SERVANT mkbaseurl s u = do auth <- uriAuthority u port <- if null (uriPort auth) @@ -75,15 +65,11 @@ parseP2PHttpUrl us basepath u = case reverse $ P.splitDirectories (uriPath u) of ("git-annex":"/":rest) -> P.joinPath (reverse rest) rest -> P.joinPath (reverse rest) -#endif unavailableP2PHttpUrl :: P2PHttpUrl -> P2PHttpUrl unavailableP2PHttpUrl p = p -#ifdef WITH_SERVANT { p2pHttpBaseUrl = (p2pHttpBaseUrl p) { baseUrlHost = "!dne!" } } -#endif -#ifdef WITH_SERVANT -- When a p2phttp url is on the same host as a git repo, which also uses -- http, the same username+password is assumed to be used for both. isP2PHttpSameHost :: P2PHttpUrl -> Git.Repo -> Bool @@ -93,4 +79,3 @@ isP2PHttpSameHost u repo Just (map toLower $ baseUrlHost (p2pHttpBaseUrl u)) == (map toLower <$> (Git.Url.host repo)) -#endif diff --git a/git-annex.cabal b/git-annex.cabal index b8ee5060ab..3dfbe76a81 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -169,9 +169,6 @@ Flag TorrentParser Flag MagicMime Description: Use libmagic to determine file MIME types -Flag Servant - Description: Use the servant library, enabling using annex+http urls and git-annex p2phttp - Flag OsPath Description: Use the os-string library and related libraries, for faster filename manipulation Default: True @@ -282,7 +279,13 @@ Executable git-annex network-bsd, git-lfs (>= 1.2.0), clock (>= 0.3.0), - crypton + crypton, + servant, + servant-server, + servant-client, + servant-client-core, + warp (>= 3.2.8), + warp-tls (>= 3.2.2) CC-Options: -Wall GHC-Options: -Wall -fno-warn-tabs -Wincomplete-uni-patterns Default-Language: Haskell2010 @@ -309,21 +312,6 @@ Executable git-annex if os(linux) || os(freebsd) GHC-Options: -optl-Wl,--as-needed - if flag(Servant) - Build-Depends: - servant, - servant-server, - servant-client, - servant-client-core, - warp (>= 3.2.8), - warp-tls (>= 3.2.2) - CPP-Options: -DWITH_SERVANT - Other-Modules: - Command.P2PHttp - P2P.Http - P2P.Http.Server - P2P.Http.State - if flag(OsPath) Build-Depends: os-string (>= 2.0.0), @@ -353,8 +341,6 @@ Executable git-annex yesod-form (>= 1.4.8), yesod-core (>= 1.6.0), path-pieces (>= 0.2.1), - warp (>= 3.2.8), - warp-tls (>= 3.2.2), wai, wai-extra, blaze-builder, @@ -718,6 +704,7 @@ Executable git-annex Command.MinCopies Command.OldKeys Command.P2P + Command.P2PHttp Command.P2PStdIO Command.PostReceive Command.PreCommit @@ -917,6 +904,9 @@ Executable git-annex P2P.Annex P2P.Auth P2P.Generic + P2P.Http + P2P.Http.Server + P2P.Http.State P2P.Http.Types P2P.Http.Client P2P.Http.Url diff --git a/stack.yaml b/stack.yaml index 58a44a292b..f4c26e49ae 100644 --- a/stack.yaml +++ b/stack.yaml @@ -9,7 +9,6 @@ flags: dbus: false debuglocks: false benchmark: true - servant: true ospath: true packages: - '.'